// dlg.txt

//MK Edit
//mark_quest_dest(zone,x,y,layer,quest);
//	code =
//		sf(,,2);
//		toggle_quest(19,10);
//		award_party_xp(MED_QUEST_XP);
//	break;

begintalkscript;

variables;

short this_town = 56;

begintalknode;
	tag = 1;
	condition = get_sdf(this_town,1) == 0;
	text1 = "A few centuries ago, some mad Rokaj decided to build an entire tower down here. Since then, lava has eaten away at the ground and cavequakes have shaken the place a hundred times, but it is somehow still standing. Good Low Dhaga craftsmanship.";
	text2 = "Now it is a small settlement. It's a safe refuge for miners, Eruds, hunters, and explorers who dare to come down here.";
	text3 = "A sign marks this as a place of truce. There are a few Ro sitting around resting, eating, and tending to their tools and weapons. They give you a quick look and then return to their work. A few guards watch the approach, in case some hungry lizards get too close.";
	code =
		sf(this_town,1,1);
	break;
	
begintalknode;
	tag = 2;
	condition = get_sdf(this_town,2) == 0;
	text1 = "Inside the tower, you can see how sturdy it is. Every surface is covered with burns and cracks, but it's still solid. More Ro are resting here. It's very hot, and they're constantly mopping their brows.";
	text2 = "There is a beautiful crystal in this hall, spreading out long, delicate fibers of stone. The tower was built around it, and, remarkably, no Ro have ever mined it. It provides a little beauty and grace to a harsh, deadly setting.";
	code =
		sf(this_town,2,1);
	break;

begintalknode;
	tag = 3;
	condition = get_sdf(this_town,3) == 0;
	text1 = "The ground to the west looks unstable. It is covered with cracks. The lava is eating away the stone under it. If you go that way, you will have to tread very lightly.";
	code =
		sf(this_town,3,1);
	break;

begintalknode;
	tag = 4;
	condition = get_sdf(this_town,4) == 0;
	text1 = "You walk up a ruined walkway, keeping a safe distance from the brutally hot vent to your right. A possible escape route is just ahead.";
	text2 = "Then you hear a growl. And another. Then a low, sinister chuckle. _The Ro are sending meals down to us now?_ A deep, sibilant voice, coming out of the vent.";
	text3 = "Then massive reptiles crawl out of the vent, blocking your escape route. The speaker is to the back: A young drake, who has not yet learned the importance of selecting sufficiently vulnerable targets.";
	code =
		sf(this_town,4,1);
		activate_hidden_group(5);
	break;

begintalknode;
	tag = 5;
	condition = get_sdf(this_town,5) == 0;
	text1 = "__";
	code =
		sf(this_town,5,1);
	break;

begintalknode;
	tag = 6;
	condition = get_sdf(this_town,6) == 0;
	text1 = "__";
	code =
		sf(this_town,6,1);
	break;

begintalknode;
	tag = 7;
	condition = get_sdf(this_town,7) == 0;
	text1 = "__";
	code =
		sf(this_town,7,1);
	break;

begintalknode;
	tag = 8;
	condition = get_sdf(this_town,8) == 0;
	text1 = "__";
	code =
		sf(this_town,8,1);
	break;

begintalknode;
	tag = 9;
	condition = get_sdf(this_town,9) == 0;
	text1 = "__";
	code =
		sf(this_town,9,1);
	break;

begintalknode;
	tag = 10;
	condition = get_sdf(this_town,10) == 0;
	text1 = "__";
	code =
		sf(this_town,10,1);
	break;

begintalknode;
	tag = 11;
	condition = get_sdf(this_town,11) == 0;
	text1 = "__";
	code =
		sf(this_town,11,1);
	break;

begintalknode;
	tag = 12;
	condition = get_sdf(this_town,12) == 0;
	text1 = "__";
	code =
		sf(this_town,12,1);
	break;

// MIXED

begintalknode;
	tag = 13;
	condition = 1;
	text1 = "There is a sudden cavequake! The ground lurches under your feet, knocking you down. The tower to the east barely budges. Sturdy construction.";
	text2 = "When things calm down, you rise to your feet. To your dismay, you realize that the rocks around you have shifted, diverting the slow, inexorable flow of the magma.";

begintalknode;
	tag = 14;
	condition = 1;
	text1 = "The drake points at you and mutters a spell. You are surrounded by a wreath of flames. They don't burn you, but they sear everyone nearby.";

begintalknode;
	tag = 15;
	condition = 1;
	text1 = "The drake falls to the ground, dead. As it expires, it has a surprised look on its face. The drakes who live long lives are the ones who learn that they are not, in fact, immortal.";
	text2 = "This was the nastiest of the pests in these caves. The miners above will likely be grateful for your aid.";
	
begintalknode; // 
	tag = 16;
	condition = 1;
	text1 = "Lizards attack sometimes.";
	text2 = "There is a truce.";
	text3 = "Looking for a new mine.";
	text4 = "Have to stay alert.";
	text5 = "You are welcome.";
	text6 = "Food is brought in.";
	text7 = "Eruds were here.";
	text8 = "Tower is sturdy.";
	action = SPEECH_BUBBLE;
	code =
		cs();
		as(get_ran(1,1,8));
	break;

begintalknode;
	tag = 17;
	condition = 1;
	text1 = "Lizards attack sometimes.";
	text2 = "There is a truce.";
	text3 = "Looking for a new mine.";
	text4 = "Have to stay alert.";
	text5 = "You are welcome.";
	text6 = "Food is brought in.";
	text7 = "Eruds were here.";
	text8 = "Tower is sturdy.";
	action = SPEECH_BUBBLE;
	code =
		cs();
		as(get_ran(1,1,8));
	break;

begintalknode;
	tag = 18;
	condition = 1;
	text1 = "__";

begintalknode;
	tag = 19;
	condition = 1;
	text1 = "__";

begintalknode;
	tag = 20;
	condition = 1;
	text1 = "__";

begintalknode;
	tag = 21;
	condition = 1;
	text1 = "__";

begintalknode;
	tag = 22;
	condition = 1;
	text1 = "__";

//// Bardi

begintalknode;
	tag = 30;
	state = -1;
	nextstate = 10;
	condition = 1;
	question = "Name";
	text1 = "There is an office in this room. An actual, functioning, kind of nice office. Some mad Ro went to great effort to bring a desk and rug and bookshelves down here. Didn't keep the soot out of the carpet, but you can't have everything.";
	text2 = "There is a young woman at the desk. She is burly, armed, and has the complexion of the Low Dhaga. She looks at the insignia on your shoulder, rises, and gives a tiny bow. Then she sits again.";
	text3 = "_Welcome to Danva's Outpost, visitor. I am Bardi. You are welcome to rest safely. We are all under truce. Please don't cause trouble. If you need any help, I'm the one to talk to._";
	text5 = "You pull up chairs and sit around Bardi's desk. She serves you cups of lukewarm water with bits of soot floating on the top and asks for news of the surface. Occasionally, the shouting and singing of drunken Ro drifts up from downstairs.";
	action = INTRO;

begintalknode;
	state = 10;
	nextstate = 11;
	condition = 1;
	question = "_Tell me about this outpost._";
	text1 = "_Well, it's dangerous down here. It's also a great place for bored Ro to come earn wealth and fame._";
	text2 = "_My predecessors decided a long time ago we needed a safe place to sleep and rest down here. We established Danva's Outpost, and it's been a refuge for a century now._";

begintalknode;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "_I am from Haven._";
	text1 = "_I noted that. You are welcome. All are welcome, as long as the truce holds. Ka-beasts aren't able to control themselves, so they aren't allowed._";

begintalknode;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "_Why do people come here?_";
	text1 = "_Sleep. Trading. Company. Sometimes, if one of us is foolish enough to stay too long, they get thrown into this room and forced to run things for a few months._";

begintalknode;
	state = 11;
	nextstate = 12;
	condition = 1;
	question = "_Who was Danva?_";
	text1 = "_Danva was the first known Ro to die in the Underworld! I mean, I'm sure plenty died before him, but he's the first person we know the name of._";

begintalknode;
	state = 12;
	nextstate = -1;
	condition = 1;
	question = "_How did he die?_";
	text1 = "_Dragged off from his group of miners by a huge cave lizard. We don't know exactly what happened next, but we have a very, very good guess._";

begintalknode;
	state = 10;
	nextstate = 19;
	condition = 1;
	question = "_I'd like to know more about the Underworld._";
	text1 = "_Hmmm. Well, information is hard to come by. We all have our own hidden tunnels and claims and places to hunt. We are friendly and peaceful here, but we like our secrets._";

begintalknode;
	state = 19;
	nextstate = -1;
	condition = 1;
	question = "_Is there anything you can tell me?_";
	text1 = "_Well, there's an old Erudico ruin to the north. We keep our distance from that. It's a mess._";
	text2 = "_There's also been some oddness to the northeast. Those previously barren caves are now full of rats. We suspect unpredictable magic, so we keep our distance._";

begintalknode;
	state = 10;
	nextstate = 13;
	condition = 1;
	question = "_What services do you provide?_";
	text1 = "_Feel free to drink. You can also sleep here without worrying about a case of slit throat._";
	text2 = "She smiles. _And you look like something of a hunter. We have good opportunities for the brave._";
	code =
		if (gf(56,12) >= 2)
			rs(2);
		break;
		
begintalknode;
	state = 13;
	nextstate = -1;
	condition = 1;
	question = "_Where can I sleep?_";
	text1 = "_Look for free beds. There's one upstairs and one downstairs. They're almost clean._";
	text2 = "You've seen them. They aren't.";
	
begintalknode;
	state = 13;
	nextstate = 14;
	condition = gf(56,12) < 2;
	question = "_Opportunities for hunters?_";
	text1 = "_Yes, with bounties! For example, the lava tunnels under this tower have been infested with strange creatures for the last few years. Abandoned magical constructs, plus a few fire lizards. They keep to themselves, but we'd like to be rid of them._";
	text2 = "_We will pay well in coin for their removal._";
	code = 
		set_flag(56,12,1);
		toggle_quest(51,1);
	break;

begintalknode;
	state = 14;
	nextstate = -1;
	condition = 1;
	question = "_How can I get to the lower caves?_";
	text1 = "_The path down is west of this tower. Tread carefully. The ground can be very unstable._";
	
begintalknode;
	state = 10;
	nextstate = -1;
	condition = gf(56,12) == 1 && gf(56,11) > 0;
	question = "_I cleaned out your basement._";
	text1 = "_Excellent! You've opened up some prime mining and storage facilities. As you can see, this little tower has become a bit snug._";
	text2 = "As promised, she counts out a pouch of silver coins. She throws in a beautiful crystal as a bonus.";
	text3 = "_If you are interested, there are other hunting opportunities down here for the determined glory-seeker._";
	code = 
		set_flag(56,12,2);
		toggle_quest(51,3);
		award_party_xp(MED_QUEST_XP);
		change_coins(100,TRUE);
		change_crafting(1,0,0,0,0);
	break;		

begintalknode;
	state = 10;
	nextstate = 15;
	condition = gf(56,12) == 2 || gf(56,12) == 3;
	question = "_There are more hunting opportunities?_";
	text1 = "_Yes. Sometimes, we get local infestations that are unattractive for our hunters, for a variety of reasons having nothing to do with cowardice._";
	text2 = "_I can provide a bounty for each one you clear up._";
	code = 
		set_flag(56,12,3);
		toggle_quest(51,4);
	break;

begintalknode;
	state = 15;
	nextstate = -1;
	condition = 1;
	question = "_What sort of bounties can I get?_";
	text1 = "_It will depend on what I have around when you report your victory. Your reward will be valuable and suitable._";

begintalknode;
	state = 15;
	nextstate = -1;
	condition = 1;
	question = "_Where do the bounties come from?_";
	text1 = "_I take collections from those who settle here from time to time. I will pay you well out of this fund. It's a bit of a jumble, but there's some quality goods in there._";

begintalknode;
	state = 15;
	nextstate = -1;
	condition = gf(56,13) == 0 || gf(56,14) == 0 || gf(56,15) == 0;
	question = "_What targets are available?_";
	text1 = "She checks her notes.";
	text2 = "_There is a big group of drakes to the east. No idea why. We're afraid they'll start picking off wanderers soon._";
	text3 = "_There is an ancient crypt to the northeast. Was looted long ago, but now it is full of rats. Dangerous and gross, but unappealing to the hunter seeking glory._";
	text4 = "_There's lots of slimes breeding around the filthy Erudico ruin to the north. One cave near their tower has been spawning slimes continuously. We'd really like it burned out._";
	code =
		if (gf(56,13) > 0)
			rs(2);
		if (gf(56,14) > 0)
			rs(3);
		if (gf(56,15) > 0)
			rs(4);
	break;
	
begintalknode;
	state = 10;
	nextstate = -1;
	condition = gf(56,12) == 3 && gf(56,13) == 0 && gf(159,12) > 0;
	question = "_I destroyed that sinister band of drakes to the east._";
	text1 = "_Excellent! They weren't eating us yet, but they were going to start any minute. Let me go through our collections and see if I can find something useful for you._";
	text2 = "She dives into the drawers of her desk and soon emerges with a scroll tube. _This was salvaged from an Erudico ruin. Useful, perhaps?_";
	text3 = "She dives into the drawers of her desk and soon emerges with a flask. _This should be far more useful to you. Hard to get potions refilled down here._";
	text4 = "She dives into the drawers of her desk and soon emerges with a ring. _I was hoping to slip away with this myself, but I have to admit you earned it._";
	code =
		sf(56,13,1);
		cs(); as(1);
		inc_flag(56,16,1);
		if (gf(56,16) == 1) {
			as(2);
			change_crafting(0,1,0,0,0);
			}
		if (gf(56,16) == 2) {
			as(3);
			reward_give(340);
			}
		if (gf(56,16) == 3) {
			as(4);
			reward_give(376);
			}
	break;

begintalknode;
	state = 10;
	nextstate = -1;
	condition = gf(56,12) == 3 && gf(56,14) == 0 && gf(149,11) > 0;
	question = "_I found that rat crypt. They're gone now._";
	text1 = "_I am glad to hear it. Those rat beasts would do nothing but breed and hunt. Let me go through our collections and see if I can find something useful for you._";
	text2 = "She dives into the drawers of her desk and soon emerges with a scroll tube. _This was salvaged from an Erudico ruin. Useful, perhaps?_";
	text3 = "She dives into the drawers of her desk and soon emerges with a flask. _This should be far more useful to you. Hard to get potions refilled down here._";
	text4 = "She dives into the drawers of her desk and soon emerges with a ring. _I was hoping to slip away with this myself, but I have to admit you earned it._";
	code =
		sf(56,14,1);
		cs(); as(1);
		inc_flag(56,16,1);
		if (gf(56,16) == 1) {
			as(2);
			change_crafting(0,1,0,0,0);
			}
		if (gf(56,16) == 2) {
			as(3);
			reward_give(340);
			}
		if (gf(56,16) == 3) {
			as(4);
			reward_give(376);
			}
	break;

begintalknode;
	state = 10;
	nextstate = -1;
	condition = gf(56,12) == 3 && gf(56,15) == 0 && gf(148,11) > 0;
	question = "_I burned out that slime pit to the north._";
	text1 = "_That is good news. Without your help, that infection would only have kept spreading. Let me go through our collections and see if I can find something useful for you._";
	text2 = "She dives into the drawers of her desk and soon emerges with a scroll tube. _This was salvaged from an Erudico ruin. Useful, perhaps?_";
	text3 = "She dives into the drawers of her desk and soon emerges with a flask. _This should be far more useful to you. Hard to get potions refilled down here._";
	text4 = "She dives into the drawers of her desk and soon emerges with a ring. _I was hoping to slip away with this myself, but I have to admit you earned it._";
	code =
		sf(56,15,1);
		cs(); as(1);
		inc_flag(56,16,1);
		if (gf(56,16) == 1) {
			as(2);
			change_crafting(0,1,0,0,0);
			}
		if (gf(56,16) == 2) {
			as(3);
			reward_give(340);
			}
		if (gf(56,16) == 3) {
			as(4);
			reward_give(376);
			}
	break;
	
begintalknode;
	state = 10;
	nextstate = -1;
	condition = gf(56,12) == 3 && gf(56,13) > 0 && gf(56,14) > 0 && gf(56,15) > 0;
	question = "_I have completed all of your bounties._";
	text1 = "She checks her notes. _So you have! Soon, the Underworld will be free of monsters, the way you're going._ She laughs. _That will never happen!_";
	text2 = "_Let me give you an extra tip out of our collections drawer._ She gives you a small pouch of precious gemstones.";
	code = 
		set_flag(56,12,4);
		toggle_quest(51,10);
		award_party_xp(MED_QUEST_XP);
		change_coins(200,1);

	break;		

begintalknode;
	state = 10;
	nextstate = -1;
	condition = gf(56,12) == 3 && (gf(56,13) == 0 || gf(56,14) == 0 || gf(56,15) == 0) && gf(56,17) == 0;
	question = "_I am done doing bounties. No more interest._";
	text1 = "_Oh well. I'll take you off my list. I figured you would not be interested in the hunt for too long. Better places to be. Still, if you kill any targets, you can still come to me for the bounty._";
	code = 
		sf(56,17,1);
		toggle_quest(51,10);
	break;
begintalknode;
	state = 10;
	nextstate = -1;
	condition = gf(56,19) == 0 && gf(57,11) > 0;
	question = "_I destroyed a rat cult in a pit near here._";
	text1 = "She laughs. _You went into the Pit? You do like to hunt! We stay away from there. Place is cursed. It just draws horrors to it. Anyone with any sense just stays far away._";
	code =
		sf(56,19,1);
	break;
	
begintalknode;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "_I'll be going now._";
	text1 = "_We wish you safe travels in this unique land._";
	action = END_TALK;
	
	
//

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 40;
	condition = 1;
	question = "Name";
	text1 = "There is a young man standing behind the counter. He is wearing a leather vest and pants, a clothing choice that is making him miserable in this hot, steamy environment.";
	text2 = "He says, _Welcome, Haven, to the Underworld. I am Trader Ged of the Kranas. I do business with all adventurers down here, as long as they behave and contribute._";
	text5 = "Trader Ged mops sweat from his brow and idly shifts weights around on his scale.";
	action = INTRO;

begintalknode;
	state = 40;
	nextstate = 41;
	condition = 1;
	question = "_You are from the Kranas Woods?_";
	text1 = "_I am. I left our forests when I was young. I am ... unusual._";

begintalknode;
	state = 41;
	nextstate = 42;
	condition = 1;
	question = "_Unusual how?_";
	text1 = "_I have a fear. The clearings, the trees stretching far overhead. Makes me feel dizzy. I panic. Poor way for a hunter of our woods to be._";

begintalknode;
	state = 42;
	nextstate = -1;
	condition = 1;
	question = "_So how did you cope with that?_";
	text1 = "He smiles. _I came here. The caves, they comfort me. Bit hot, is true. Still, I am one of the few who stays here because I like it._";

begintalknode;
	state = 40;
	nextstate = 44;
	condition = gf(56,11) == 0;
	question = "_I would like to trade with you._";
	text1 = "_Yes, we can trade. I trade with all who do their part to maintain the outpost. To be fully welcome here, you need to do chores._";

begintalknode;
	state = 44;
	nextstate = -1;
	condition = 1;
	question = "_Chores? What do you mean?_";
	text1 = "_All do the chores they are able to. You, you look very capable. Go upstairs and talk to Bardi. She knows about our pest problems._";
	action = END_TALK;

begintalknode;
	state = 40;
	nextstate = 46;
	condition = gf(56,11) > 0;
	question = "_I would like to trade with you._";
	text1 = "_Of course. This is a great place to barter, and we are grateful for your aid. We buy and sell. What do you need?_";

begintalknode;
	state = 46;
	nextstate = -1;
	condition = 1;
	question = "_I am buying._";
	text1 = "You conclude your business.";	
	code = 
		begin_shop_mode("Danva's Outpost",
		  "shopdesc.",
		  32,4,0);	
	break;

begintalknode;
	state = 46;
	nextstate = -1;
	condition = 1;
	question = "_I am selling._";
	text1 = "You conclude your business.";	
	code = 
		start_alter_items(0);
	break;

begintalknode;
	state = 46;
	nextstate = -1;
	condition = 1;
	question = "_That is all I need._";
	text1 = "_Then be wary. The Underworld can seem like a beautiful place. It will seem that way until seconds before it kills you._";
	action = END_TALK;

	
//

begintalknode;
	tag = 70;
	state = -1;
	nextstate = 70;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";


//

begintalknode;
	tag = 100;
	state = -1;
	nextstate = 100;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 100;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

//

begintalknode;
	tag = 130;
	state = -1;
	nextstate = 130;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 130;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

//

begintalknode;
	tag = 160;
	state = -1;
	nextstate = 160;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 160;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";
		
//

begintalknode;
	tag = 190;
	state = -1;
	nextstate = 190;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 190;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";
				